package com.eliza.springboot.v3.actuator.meteric

import io.micrometer.core.instrument.MeterRegistry
import org.springframework.boot.actuate.health.AbstractHealthIndicator
import org.springframework.boot.actuate.health.Health
import org.springframework.boot.actuate.health.HealthIndicator
import org.springframework.stereotype.Component

// 1 实现接口定制健康返回
//@Component
//class Health : HealthIndicator {
//    override fun health(): Health {
//        return Health.down().withDetail("status", 1).build()
//    }
//}

//http://192.168.20.5:8080/actuator/health
// 2 直接实现
@Component
class MyMeterRegistry(registry: MeterRegistry) {
    //创建计数器
    val counter = registry.counter("MyMeterRegistry.counter")
    fun hello() {
        println("MyMeterRegistry 记录")
        counter.increment()
    }

}